<!--
 * @description  : 市管检查-流出问题组件
 * @descriptionDetail: 市管检查-流出问题组件
 * @copyright    : 浙江烟草
 * @author       : sy
 * @create       : 2022-07-09 18:43:02
-->
<template>
  <view>
    <theme-navbar
      :isBack="true"
      :is-white="false"
      title="流出问题"
      :customBack="handlerBack"
      style="z-index: 99999"
    >
      <view class="nav-right-icon" v-if="!isDisabled" @tap="handlerSure">
        确定
      </view>
    </theme-navbar>
    <view>
      <u-cell-item class="cell" title="是否经营假烟" :arrow="false">
        <u-switch :disabled="isDisabled" slot="right-icon" v-model="isStock"></u-switch>
      </u-cell-item>
      <u-field
        type="textarea"
        placeholder="请输入"
        label="备注"
        label-width="80"
        style="height: 180px;"
        :disabled="isDisabled"
        :border-top="true"
        v-model="memo"
      >
      </u-field>
    </view>
  </view>
</template>
<script>
export default {
  name: "OutflowCom",
  props: {
    menuData: {
      type: Object,
      default: () => {},
    },
    isDisabled: {   // 是否可编辑
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {
      isStock: false,   // 是否库存异常下降
      memo: "",         // 备注
    }
  },
  watch: {
    menuData(v) {
      console.log("监听", v);
    },
  },
  created () {
    // 回显数据
    this.menuData.records.forEach(r => {
      r.itemUuid == '34020201' && (this.isStock = r.checkData || false);
      r.itemUuid == '34020202' && (this.memo = r.checkData || '');
    });
  },
  methods: {
    // 确定
    handlerSure() {
      this.$emit("ok", {
        34020201: this.isStock,
        34020202: this.memo,
      });
    },
    // 关闭
    handlerBack() {
      this.$emit("close", true);
    },
  },
}
</script>
<style lang="scss" scoped>
@import "@/style/common/rightMenu.scss";
.cell {
  padding: 10px 16px;
}
.cell-sub {
  padding-left: 30px;
}
</style>